import axios from "axios";
export default {
    created() {
        this.init()
    },
    data() {
        return {
            list: [],
            pageInfo: {
                pagenum: 1,
                pagesize: 10,
            },
            total: 0,
        };
    },
    methods: {
        init() {
            axios.get("https://api-hmugo-web.itheima.net/api/public/v1/goods/search", {
                params: {
                    cid: 10,
                    ...this.pageInfo,
                },
            })
                .then((res) => {
                    this.total = res.message.total;
                    this.list = res.message.goods;
                    console.log(res.message);
                });
        },
        change(pagenum) {
            this.pageInfo.pagenum = pagenum;
            this.init()
        },
    },
}